﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>jQuery Ajax - AjaxEvent</title>

    <script type="text/javascript" src="../scripts/jquery-1.7.1.js"></script>

    <script type="text/javascript">
        $(document).ready(function () {
            $.support.cors = true;

            $("#btnAjax").bind("click", function (event) {
                $.get("http://www.baidu.com");
            });

            $("#divResult").ajaxComplete(function (evt, request, settings) { $(this).append('<div>ajaxComplete</div>'); });
            $("#divResult").ajaxError(function (evt, request, settings) { $(this).append('<div>' + request.statusText + '</div>'); });
            $("#divResult").ajaxSend(function (evt, request, settings) { $(this).append('<div>ajaxSend</div>'); });
            $("#divResult").ajaxStart(function () { $(this).append('<div>ajaxStart</div>'); });
            $("#divResult").ajaxStop(function () { $(this).append('<div>ajaxStop</div>'); });
            $("#divResult").ajaxSuccess(function (evt, request, settings) { $(this).append('<div>ajaxSuccess</div>'); });

        });

    </script>

</head>
<body>
    <br />
    <button id="btnAjax">发送Ajax请求</button><br />
    <div id="divResult"></div>
</body>
</html>
